dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/15] forward MSIx vector enable error code in pci_alloc_irq_vectors_affinity
@ 2020-06-02  9:16 Piotr Stankiewicz
  2020-06-02 23:06 ` Bjorn Helgaas
  0 siblings, 1 reply; 14+ messages in thread
From: Piotr Stankiewicz @ 2020-06-02  9:16 UTC (permalink / raw)
  To: Bjorn Helgaas, Jonathan Corbet, Jens Axboe, Kurt Schwemmer,
	Logan Gunthorpe, Antoine Tenart, Herbert Xu, David S . Miller,
	Gustavo Pimentel, Dan Williams, Vinod Koul, Alex Deucher,
	Christian König, David Zhou, David Airlie, Daniel Vetter,
	Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
	Jason Gunthorpe, Mauro Carvalho Chehab, Arnd Bergmann,
	Greg Kroah-Hartman, Adrian Hunter, Ulf Hansson, Tom Lendacky,
	Jakub Kicinski, Igor Russkikh, Yisen Zhuang, Salil Mehta,
	Brian King, James E . J . Bottomley, Martin K . Petersen,
	Jim Gill, VMware PV-Drivers
  Cc: amd-gfx, linux-scsi, linux-doc, linux-rdma, linux-pci, linux-mmc,
	linux-kernel, dri-devel, Piotr Stankiewicz, linux-crypto, netdev,
	dmaengine, linux-media

The primary objective of this patch series is to change the behaviour
of pci_alloc_irq_vectors_affinity such that it forwards the MSI-X enable
error code when appropriate. In the process, though, it was pointed out
that there are multiple places in the kernel which check/ask for message
signalled interrupts (MSI or MSI-X), which spawned the first patch adding
PCI_IRQ_MSI_TYPES. Finally the rest of the chain converts all users to
take advantage of PCI_IRQ_MSI_TYPES or PCI_IRQ_ALL_TYPES, as
appropriate.

Piotr Stankiewicz (15):
  PCI: add shorthand define for message signalled interrupt types
  PCI/MSI: forward MSIx vector enable error code in
    pci_alloc_irq_vectors_affinity
  PCI: use PCI_IRQ_MSI_TYPES where appropriate
  ahci: use PCI_IRQ_MSI_TYPES where appropriate
  crypto: inside-secure - use PCI_IRQ_MSI_TYPES where appropriate
  dmaengine: dw-edma: use PCI_IRQ_MSI_TYPES  where appropriate
  drm/amdgpu: use PCI_IRQ_MSI_TYPES where appropriate
  IB/qib: Use PCI_IRQ_MSI_TYPES where appropriate
  media: ddbridge: use PCI_IRQ_MSI_TYPES where appropriate
  vmw_vmci: use PCI_IRQ_ALL_TYPES where appropriate
  mmc: sdhci: use PCI_IRQ_MSI_TYPES where appropriate
  amd-xgbe: use PCI_IRQ_MSI_TYPES where appropriate
  aquantia: atlantic: use PCI_IRQ_ALL_TYPES where appropriate
  net: hns3: use PCI_IRQ_MSI_TYPES where appropriate
  scsi: use PCI_IRQ_MSI_TYPES and PCI_IRQ_ALL_TYPES where appropriate

 Documentation/PCI/msi-howto.rst                           | 5 +++--
 drivers/ata/ahci.c                                        | 2 +-
 drivers/crypto/inside-secure/safexcel.c                   | 2 +-
 drivers/dma/dw-edma/dw-edma-pcie.c                        | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c                   | 8 ++++----
 drivers/infiniband/hw/qib/qib_pcie.c                      | 2 +-
 drivers/media/pci/ddbridge/ddbridge-main.c                | 2 +-
 drivers/misc/vmw_vmci/vmci_guest.c                        | 3 +--
 drivers/mmc/host/sdhci-pci-gli.c                          | 3 +--
 drivers/mmc/host/sdhci-pci-o2micro.c                      | 3 +--
 drivers/net/ethernet/amd/xgbe/xgbe-pci.c                  | 2 +-
 drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c      | 4 +---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c   | 3 +--
 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 2 +-
 drivers/pci/msi.c                                         | 4 ++--
 drivers/pci/pcie/portdrv_core.c                           | 4 ++--
 drivers/pci/switch/switchtec.c                            | 3 +--
 drivers/scsi/ipr.c                                        | 2 +-
 drivers/scsi/vmw_pvscsi.c                                 | 2 +-
 include/linux/pci.h                                       | 4 ++--
 20 files changed, 28 insertions(+), 34 deletions(-)

-- 
2.17.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 00/15] forward MSIx vector enable error code in pci_alloc_irq_vectors_affinity
  2020-06-02  9:16 [PATCH 00/15] forward MSIx vector enable error code in pci_alloc_irq_vectors_affinity Piotr Stankiewicz
@ 2020-06-02 23:06 ` Bjorn Helgaas
  2020-06-03 11:42   ` [PATCH v2 00/15] Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity() Piotr Stankiewicz
  0 siblings, 1 reply; 14+ messages in thread
From: Bjorn Helgaas @ 2020-06-02 23:06 UTC (permalink / raw)
  To: Piotr Stankiewicz
  Cc: Ulf Hansson, Igor Russkikh, linux-doc, David Airlie, linux-pci,
	dri-devel, Jim Gill, netdev, Kurt Schwemmer, Herbert Xu,
	linux-scsi, Jonathan Corbet, linux-rdma, amd-gfx,
	Jason Gunthorpe, Doug Ledford, Jakub Kicinski, Yisen Zhuang,
	linux-media, Tom Lendacky, Arnd Bergmann, Antoine Tenart,
	linux-kernel, James E . J . Bottomley, Salil Mehta, dmaengine,
	Brian King, VMware PV-Drivers, Bjorn Helgaas, Dan Williams,
	Mauro Carvalho Chehab, Jens Axboe, Mike Marciniszyn,
	Martin K . Petersen, Gustavo Pimentel, Dennis Dalessandro,
	linux-mmc, Adrian Hunter, David S . Miller, Vinod Koul,
	linux-crypto, Greg Kroah-Hartman, Alex Deucher, Logan Gunthorpe,
	Christian König

On Tue, Jun 02, 2020 at 11:16:17AM +0200, Piotr Stankiewicz wrote:
> The primary objective of this patch series is to change the behaviour
> of pci_alloc_irq_vectors_affinity such that it forwards the MSI-X enable
> error code when appropriate. In the process, though, it was pointed out
> that there are multiple places in the kernel which check/ask for message
> signalled interrupts (MSI or MSI-X), which spawned the first patch adding
> PCI_IRQ_MSI_TYPES. Finally the rest of the chain converts all users to
> take advantage of PCI_IRQ_MSI_TYPES or PCI_IRQ_ALL_TYPES, as
> appropriate.
> 
> Piotr Stankiewicz (15):
>   PCI: add shorthand define for message signalled interrupt types
>   PCI/MSI: forward MSIx vector enable error code in
>     pci_alloc_irq_vectors_affinity
>   PCI: use PCI_IRQ_MSI_TYPES where appropriate
>   ahci: use PCI_IRQ_MSI_TYPES where appropriate
>   crypto: inside-secure - use PCI_IRQ_MSI_TYPES where appropriate
>   dmaengine: dw-edma: use PCI_IRQ_MSI_TYPES  where appropriate
>   drm/amdgpu: use PCI_IRQ_MSI_TYPES where appropriate
>   IB/qib: Use PCI_IRQ_MSI_TYPES where appropriate
>   media: ddbridge: use PCI_IRQ_MSI_TYPES where appropriate
>   vmw_vmci: use PCI_IRQ_ALL_TYPES where appropriate
>   mmc: sdhci: use PCI_IRQ_MSI_TYPES where appropriate
>   amd-xgbe: use PCI_IRQ_MSI_TYPES where appropriate
>   aquantia: atlantic: use PCI_IRQ_ALL_TYPES where appropriate
>   net: hns3: use PCI_IRQ_MSI_TYPES where appropriate
>   scsi: use PCI_IRQ_MSI_TYPES and PCI_IRQ_ALL_TYPES where appropriate
> 
>  Documentation/PCI/msi-howto.rst                           | 5 +++--
>  drivers/ata/ahci.c                                        | 2 +-
>  drivers/crypto/inside-secure/safexcel.c                   | 2 +-
>  drivers/dma/dw-edma/dw-edma-pcie.c                        | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c                   | 8 ++++----
>  drivers/infiniband/hw/qib/qib_pcie.c                      | 2 +-
>  drivers/media/pci/ddbridge/ddbridge-main.c                | 2 +-
>  drivers/misc/vmw_vmci/vmci_guest.c                        | 3 +--
>  drivers/mmc/host/sdhci-pci-gli.c                          | 3 +--
>  drivers/mmc/host/sdhci-pci-o2micro.c                      | 3 +--
>  drivers/net/ethernet/amd/xgbe/xgbe-pci.c                  | 2 +-
>  drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c      | 4 +---
>  drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c   | 3 +--
>  drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 2 +-
>  drivers/pci/msi.c                                         | 4 ++--
>  drivers/pci/pcie/portdrv_core.c                           | 4 ++--
>  drivers/pci/switch/switchtec.c                            | 3 +--
>  drivers/scsi/ipr.c                                        | 2 +-
>  drivers/scsi/vmw_pvscsi.c                                 | 2 +-
>  include/linux/pci.h                                       | 4 ++--
>  20 files changed, 28 insertions(+), 34 deletions(-)

I think I'm OK with this, and since they all depend on the first PCI
patch, it will probably be easiest to merge them all through the PCI
tree.  I'm happy to do that, but can you please:

  - Update the subject lines so they start with a capital letter to
    match the historical convention.

  - Use "MSI-X" instead of "MSIx" so it matches the spec and other
    usage in the kernel.

  - Add "()" after function names, e.g.,
    "pci_alloc_irq_vectors_affinity()" instead of
    "pci_alloc_irq_vectors_affinity".

  - Reorder them so the actual fix (02/15) is first and the cleanups
    later.

  - Post them all to linux-pci (I only saw the drivers/pci patches).

  - If possible, post them with all the patches as replies to the
    cover letter.  These all appear to be unrelated messages, which
    makes it a bit of a hassle to collect them all up.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 00/15] Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity()
  2020-06-02 23:06 ` Bjorn Helgaas
@ 2020-06-03 11:42   ` Piotr Stankiewicz
  2020-06-03 11:45     ` [PATCH v2 02/15] PCI: Add shorthand define for message signalled interrupt types Piotr Stankiewicz
                       ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Piotr Stankiewicz @ 2020-06-03 11:42 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci
  Cc: Ulf Hansson, Igor Russkikh, linux-doc, David Airlie, dri-devel,
	Jim Gill, netdev, Kurt Schwemmer, Herbert Xu, linux-scsi,
	Jonathan Corbet, linux-rdma, amd-gfx, Jason Gunthorpe,
	Doug Ledford, Jakub Kicinski, Yisen Zhuang, linux-media,
	Tom Lendacky, Arnd Bergmann, Antoine Tenart, linux-kernel,
	James E . J . Bottomley, Salil Mehta, dmaengine, Brian King,
	VMware PV-Drivers, Dan Williams, Mauro Carvalho Chehab,
	Jens Axboe, Mike Marciniszyn, Martin K . Petersen,
	Gustavo Pimentel, Dennis Dalessandro, linux-mmc, Adrian Hunter,
	David S . Miller, Vinod Koul, linux-crypto, Greg Kroah-Hartman,
	Alex Deucher, Piotr Stankiewicz, Logan Gunthorpe,
	Christian König

The primary objective of this patch series is to change the behaviour
of pci_alloc_irq_vectors_affinity() such that it forwards the MSI-X enable
error code when appropriate. In the process, though, it was pointed out
that there are multiple places in the kernel which check/ask for message
signalled interrupts (MSI or MSI-X), which spawned the first patch adding
PCI_IRQ_MSI_TYPES. Finally the rest of the chain converts all users to
take advantage of PCI_IRQ_MSI_TYPES or PCI_IRQ_ALL_TYPES, as
appropriate.

Piotr Stankiewicz (15):
  PCI/MSI: Forward MSI-X vector enable error code in
    pci_alloc_irq_vectors_affinity()
  PCI: Add shorthand define for message signalled interrupt types
  PCI: Use PCI_IRQ_MSI_TYPES where appropriate
  ahci: Use PCI_IRQ_MSI_TYPES where appropriate
  crypto: inside-secure - Use PCI_IRQ_MSI_TYPES where appropriate
  dmaengine: dw-edma: Use PCI_IRQ_MSI_TYPES  where appropriate
  drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate
  IB/qib: Use PCI_IRQ_MSI_TYPES where appropriate
  media: ddbridge: Use PCI_IRQ_MSI_TYPES where appropriate
  vmw_vmci: Use PCI_IRQ_ALL_TYPES where appropriate
  mmc: sdhci: Use PCI_IRQ_MSI_TYPES where appropriate
  amd-xgbe: Use PCI_IRQ_MSI_TYPES where appropriate
  aquantia: atlantic: Use PCI_IRQ_ALL_TYPES where appropriate
  net: hns3: Use PCI_IRQ_MSI_TYPES where appropriate
  scsi: Use PCI_IRQ_MSI_TYPES and PCI_IRQ_ALL_TYPES where appropriate

 Documentation/PCI/msi-howto.rst                          | 5 +++--
 drivers/ata/ahci.c                                       | 2 +-
 drivers/crypto/inside-secure/safexcel.c                  | 2 +-
 drivers/dma/dw-edma/dw-edma-pcie.c                       | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c                  | 9 ++-------
 drivers/infiniband/hw/qib/qib_pcie.c                     | 6 ++++--
 drivers/media/pci/ddbridge/ddbridge-main.c               | 2 +-
 drivers/misc/vmw_vmci/vmci_guest.c                       | 3 +--
 drivers/mmc/host/sdhci-pci-gli.c                         | 3 +--
 drivers/mmc/host/sdhci-pci-o2micro.c                     | 3 +--
 drivers/net/ethernet/amd/xgbe/xgbe-pci.c                 | 2 +-
 drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c     | 4 +---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c  | 3 +--
 .../net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c    | 3 +--
 drivers/pci/msi.c                                        | 4 ++--
 drivers/pci/pcie/portdrv_core.c                          | 4 ++--
 drivers/pci/switch/switchtec.c                           | 3 +--
 drivers/scsi/ipr.c                                       | 5 +++--
 drivers/scsi/vmw_pvscsi.c                                | 2 +-
 include/linux/pci.h                                      | 4 ++--
 20 files changed, 31 insertions(+), 40 deletions(-)

-- 
2.17.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 02/15] PCI: Add shorthand define for message signalled interrupt types
  2020-06-03 11:42   ` [PATCH v2 00/15] Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity() Piotr Stankiewicz
@ 2020-06-03 11:45     ` Piotr Stankiewicz
  2020-06-03 15:49       ` Logan Gunthorpe
  2020-06-04  1:55       ` Luben Tuikov
  2020-06-03 11:47     ` [PATCH v2 07/15] drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate Piotr Stankiewicz
  2020-06-09  9:11     ` [PATCH v3 00/15] Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity() Piotr Stankiewicz
  2 siblings, 2 replies; 14+ messages in thread
From: Piotr Stankiewicz @ 2020-06-03 11:45 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci
  Cc: Krzysztof Wilczynski, Ulf Hansson, Igor Russkikh, linux-doc,
	David Airlie, Kuppuswamy Sathyanarayanan, dri-devel, Jim Gill,
	netdev, Kurt Schwemmer, Herbert Xu, linux-scsi, Jonathan Corbet,
	linux-rdma, Rafael J. Wysocki, amd-gfx, Jason Gunthorpe,
	Doug Ledford, Zenghui Yu, Jakub Kicinski, Yisen Zhuang,
	linux-media, Tom Lendacky, Arnd Bergmann, Antoine Tenart,
	linux-kernel, James E . J . Bottomley, Salil Mehta,
	Denis Efremov, dmaengine, Brian King, VMware PV-Drivers,
	Dan Williams, Mauro Carvalho Chehab, Andy Shevchenko, Jens Axboe,
	Mike Marciniszyn, Martin K . Petersen, Gustavo Pimentel,
	Dennis Dalessandro, linux-mmc, Adrian Hunter, David S . Miller,
	Vinod Koul, linux-crypto, Greg Kroah-Hartman, Alex Deucher,
	Piotr Stankiewicz, Kelsey Skunberg, Heiner Kallweit,
	Logan Gunthorpe, Christian König, Andrew Murray

There are several places in the kernel which check/ask for MSI or MSI-X
interrupts. It would make sense to have a shorthand constant, similar to
PCI_IRQ_ALL_TYPES, to use in these situations. So add PCI_IRQ_MSI_TYPES,
for this purpose.

Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@intel.com>
Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
 Documentation/PCI/msi-howto.rst | 5 +++--
 include/linux/pci.h             | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Documentation/PCI/msi-howto.rst b/Documentation/PCI/msi-howto.rst
index aa2046af69f7..2800ff5aa395 100644
--- a/Documentation/PCI/msi-howto.rst
+++ b/Documentation/PCI/msi-howto.rst
@@ -105,7 +105,8 @@ if it can't meet the minimum number of vectors.
 The flags argument is used to specify which type of interrupt can be used
 by the device and the driver (PCI_IRQ_LEGACY, PCI_IRQ_MSI, PCI_IRQ_MSIX).
 A convenient short-hand (PCI_IRQ_ALL_TYPES) is also available to ask for
-any possible kind of interrupt.  If the PCI_IRQ_AFFINITY flag is set,
+any possible kind of interrupt, and (PCI_IRQ_MSI_TYPES) to ask for message
+signalled interrupts (MSI or MSI-X).  If the PCI_IRQ_AFFINITY flag is set,
 pci_alloc_irq_vectors() will spread the interrupts around the available CPUs.
 
 To get the Linux IRQ numbers passed to request_irq() and free_irq() and the
@@ -160,7 +161,7 @@ the single MSI mode for a device.  It could be done by passing two 1s as
 Some devices might not support using legacy line interrupts, in which case
 the driver can specify that only MSI or MSI-X is acceptable::
 
-	nvec = pci_alloc_irq_vectors(pdev, 1, nvec, PCI_IRQ_MSI | PCI_IRQ_MSIX);
+	nvec = pci_alloc_irq_vectors(pdev, 1, nvec, PCI_IRQ_MSI_TYPES);
 	if (nvec < 0)
 		goto out_err;
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 83ce1cdf5676..b6c9bf70363e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1422,8 +1422,8 @@ int pci_set_vga_state(struct pci_dev *pdev, bool decode,
  */
 #define PCI_IRQ_VIRTUAL		(1 << 4)
 
-#define PCI_IRQ_ALL_TYPES \
-	(PCI_IRQ_LEGACY | PCI_IRQ_MSI | PCI_IRQ_MSIX)
+#define PCI_IRQ_MSI_TYPES	(PCI_IRQ_MSI | PCI_IRQ_MSIX)
+#define PCI_IRQ_ALL_TYPES	(PCI_IRQ_LEGACY | PCI_IRQ_MSI_TYPES)
 
 /* kmem_cache style wrapper around pci_alloc_consistent() */
 
-- 
2.17.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 07/15] drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate
  2020-06-03 11:42   ` [PATCH v2 00/15] Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity() Piotr Stankiewicz
  2020-06-03 11:45     ` [PATCH v2 02/15] PCI: Add shorthand define for message signalled interrupt types Piotr Stankiewicz
@ 2020-06-03 11:47     ` Piotr Stankiewicz
  2020-06-03 13:43       ` Alex Deucher
  2020-06-09  9:11     ` [PATCH v3 00/15] Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity() Piotr Stankiewicz
  2 siblings, 1 reply; 14+ messages in thread
From: Piotr Stankiewicz @ 2020-06-03 11:47 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci
  Cc: David Airlie, linux-kernel, amd-gfx, Emily Deng,
	Piotr Stankiewicz, dri-devel, Alex Deucher, shaoyunl,
	Sam Ravnborg, Christian König, Hawking Zhang

Seeing as there is shorthand available to use when asking for any type
of interrupt, or any type of message signalled interrupt, leverage it.

Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 5ed4227f304b..2588dd1015db 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -249,15 +249,10 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
 
 	if (amdgpu_msi_ok(adev)) {
 		int nvec = pci_msix_vec_count(adev->pdev);
-		unsigned int flags;
 
-		if (nvec <= 0) {
-			flags = PCI_IRQ_MSI;
-		} else {
-			flags = PCI_IRQ_MSI | PCI_IRQ_MSIX;
-		}
 		/* we only need one vector */
-		nvec = pci_alloc_irq_vectors(adev->pdev, 1, 1, flags);
+		nvec = pci_alloc_irq_vectors(adev->pdev, 1, 1,
+					     PCI_IRQ_MSI_TYPES);
 		if (nvec > 0) {
 			adev->irq.msi_enabled = true;
 			dev_dbg(adev->dev, "amdgpu: using MSI/MSI-X.\n");
-- 
2.17.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 07/15] drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate
  2020-06-03 11:47     ` [PATCH v2 07/15] drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate Piotr Stankiewicz
@ 2020-06-03 13:43       ` Alex Deucher
  0 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2020-06-03 13:43 UTC (permalink / raw)
  To: Piotr Stankiewicz
  Cc: David Airlie, Linux PCI, LKML, amd-gfx list, Emily Deng,
	Maling list - DRI developers, Bjorn Helgaas, Alex Deucher,
	Hawking Zhang, Sam Ravnborg, Christian König, shaoyunl

On Wed, Jun 3, 2020 at 7:48 AM Piotr Stankiewicz
<piotr.stankiewicz@intel.com> wrote:
>
> Seeing as there is shorthand available to use when asking for any type
> of interrupt, or any type of message signalled interrupt, leverage it.
>
> Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@intel.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> index 5ed4227f304b..2588dd1015db 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> @@ -249,15 +249,10 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>
>         if (amdgpu_msi_ok(adev)) {
>                 int nvec = pci_msix_vec_count(adev->pdev);

I think you can drop pci_msix_vec_count() here.  It's not used since
we always request 1 vector.

Alex

> -               unsigned int flags;
>
> -               if (nvec <= 0) {
> -                       flags = PCI_IRQ_MSI;
> -               } else {
> -                       flags = PCI_IRQ_MSI | PCI_IRQ_MSIX;
> -               }
>                 /* we only need one vector */
> -               nvec = pci_alloc_irq_vectors(adev->pdev, 1, 1, flags);
> +               nvec = pci_alloc_irq_vectors(adev->pdev, 1, 1,
> +                                            PCI_IRQ_MSI_TYPES);
>                 if (nvec > 0) {
>                         adev->irq.msi_enabled = true;
>                         dev_dbg(adev->dev, "amdgpu: using MSI/MSI-X.\n");
> --
> 2.17.2
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 02/15] PCI: Add shorthand define for message signalled interrupt types
  2020-06-03 11:45     ` [PATCH v2 02/15] PCI: Add shorthand define for message signalled interrupt types Piotr Stankiewicz
@ 2020-06-03 15:49       ` Logan Gunthorpe
  2020-06-04  1:55       ` Luben Tuikov
  1 sibling, 0 replies; 14+ messages in thread
From: Logan Gunthorpe @ 2020-06-03 15:49 UTC (permalink / raw)
  To: Piotr Stankiewicz, Bjorn Helgaas, linux-pci
  Cc: Krzysztof Wilczynski, Ulf Hansson, Igor Russkikh, linux-doc,
	David Airlie, Kuppuswamy Sathyanarayanan, dri-devel, Jim Gill,
	netdev, Kurt Schwemmer, Herbert Xu, linux-scsi, Jonathan Corbet,
	linux-rdma, Rafael J. Wysocki, amd-gfx, Jason Gunthorpe,
	Doug Ledford, Zenghui Yu, Jakub Kicinski, Yisen Zhuang,
	linux-media, Tom Lendacky, Arnd Bergmann, Antoine Tenart,
	linux-kernel, James E . J . Bottomley, Salil Mehta,
	Denis Efremov, dmaengine, Brian King, VMware PV-Drivers,
	Dan Williams, Mauro Carvalho Chehab, Andy Shevchenko, Jens Axboe,
	Mike Marciniszyn, Martin K . Petersen, Gustavo Pimentel,
	Dennis Dalessandro, linux-mmc, Adrian Hunter, David S . Miller,
	Vinod Koul, linux-crypto, Greg Kroah-Hartman, Alex Deucher,
	Kelsey Skunberg, Heiner Kallweit, Christian König,
	Andrew Murray



On 2020-06-03 5:45 a.m., Piotr Stankiewicz wrote:
> There are several places in the kernel which check/ask for MSI or MSI-X
> interrupts. It would make sense to have a shorthand constant, similar to
> PCI_IRQ_ALL_TYPES, to use in these situations. So add PCI_IRQ_MSI_TYPES,
> for this purpose.
> 
> Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@intel.com>
> Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

Looks good to me,

Reviewed-by: Logan Gunthorpe <logang@deltatee.com>

Thanks,

Logan
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 02/15] PCI: Add shorthand define for message signalled interrupt types
  2020-06-03 11:45     ` [PATCH v2 02/15] PCI: Add shorthand define for message signalled interrupt types Piotr Stankiewicz
  2020-06-03 15:49       ` Logan Gunthorpe
@ 2020-06-04  1:55       ` Luben Tuikov
  1 sibling, 0 replies; 14+ messages in thread
From: Luben Tuikov @ 2020-06-04  1:55 UTC (permalink / raw)
  To: Piotr Stankiewicz, Bjorn Helgaas, linux-pci
  Cc: Krzysztof Wilczynski, Ulf Hansson, Igor Russkikh, linux-doc,
	David Airlie, Kuppuswamy Sathyanarayanan, dri-devel, Jim Gill,
	Adrian Hunter, VMware PV-Drivers, Herbert Xu, linux-scsi,
	Jonathan Corbet, linux-rdma, Rafael J. Wysocki, amd-gfx,
	Jason Gunthorpe, Doug Ledford, Zenghui Yu, Jakub Kicinski,
	Yisen Zhuang, linux-media, Tom Lendacky, Arnd Bergmann,
	Antoine Tenart, James E . J . Bottomley, Dan Williams,
	Mike Marciniszyn, Denis Efremov, Alex Deucher, Brian King,
	Greg Kroah-Hartman, Kurt Schwemmer, Mauro Carvalho Chehab,
	Andy Shevchenko, Jens Axboe, Salil Mehta, Martin K . Petersen,
	netdev, Dennis Dalessandro, linux-mmc, linux-kernel,
	Christian König, Vinod Koul, linux-crypto, Gustavo Pimentel,
	dmaengine, Kelsey Skunberg, Andrew Murray, Logan Gunthorpe,
	David S . Miller, Heiner Kallweit

That's a sensible change.

In your title you can use "macro" or "definition" or "macro definition".
"Define" is a verb.
"PCI: Add a macro for message-signalled interrupt types"

On 2020-06-03 7:45 a.m., Piotr Stankiewicz wrote:
> There are several places in the kernel which check/ask for MSI or MSI-X
> interrupts. It would make sense to have a shorthand constant, similar to

"a shorthand constant" --> "a macro which defines all MSI-type of interrupt."

Regards,
Luben

> PCI_IRQ_ALL_TYPES, to use in these situations. So add PCI_IRQ_MSI_TYPES,
> for this purpose.
> 
> Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@intel.com>
> Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> ---
>  Documentation/PCI/msi-howto.rst | 5 +++--
>  include/linux/pci.h             | 4 ++--
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/PCI/msi-howto.rst b/Documentation/PCI/msi-howto.rst
> index aa2046af69f7..2800ff5aa395 100644
> --- a/Documentation/PCI/msi-howto.rst
> +++ b/Documentation/PCI/msi-howto.rst
> @@ -105,7 +105,8 @@ if it can't meet the minimum number of vectors.
>  The flags argument is used to specify which type of interrupt can be used
>  by the device and the driver (PCI_IRQ_LEGACY, PCI_IRQ_MSI, PCI_IRQ_MSIX).
>  A convenient short-hand (PCI_IRQ_ALL_TYPES) is also available to ask for
> -any possible kind of interrupt.  If the PCI_IRQ_AFFINITY flag is set,
> +any possible kind of interrupt, and (PCI_IRQ_MSI_TYPES) to ask for message
> +signalled interrupts (MSI or MSI-X).  If the PCI_IRQ_AFFINITY flag is set,
>  pci_alloc_irq_vectors() will spread the interrupts around the available CPUs.
>  
>  To get the Linux IRQ numbers passed to request_irq() and free_irq() and the
> @@ -160,7 +161,7 @@ the single MSI mode for a device.  It could be done by passing two 1s as
>  Some devices might not support using legacy line interrupts, in which case
>  the driver can specify that only MSI or MSI-X is acceptable::
>  
> -	nvec = pci_alloc_irq_vectors(pdev, 1, nvec, PCI_IRQ_MSI | PCI_IRQ_MSIX);
> +	nvec = pci_alloc_irq_vectors(pdev, 1, nvec, PCI_IRQ_MSI_TYPES);
>  	if (nvec < 0)
>  		goto out_err;
>  
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 83ce1cdf5676..b6c9bf70363e 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1422,8 +1422,8 @@ int pci_set_vga_state(struct pci_dev *pdev, bool decode,
>   */
>  #define PCI_IRQ_VIRTUAL		(1 << 4)
>  
> -#define PCI_IRQ_ALL_TYPES \
> -	(PCI_IRQ_LEGACY | PCI_IRQ_MSI | PCI_IRQ_MSIX)
> +#define PCI_IRQ_MSI_TYPES	(PCI_IRQ_MSI | PCI_IRQ_MSIX)
> +#define PCI_IRQ_ALL_TYPES	(PCI_IRQ_LEGACY | PCI_IRQ_MSI_TYPES)
>  
>  /* kmem_cache style wrapper around pci_alloc_consistent() */
>  
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v3 00/15] Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity()
  2020-06-03 11:42   ` [PATCH v2 00/15] Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity() Piotr Stankiewicz
  2020-06-03 11:45     ` [PATCH v2 02/15] PCI: Add shorthand define for message signalled interrupt types Piotr Stankiewicz
  2020-06-03 11:47     ` [PATCH v2 07/15] drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate Piotr Stankiewicz
@ 2020-06-09  9:11     ` Piotr Stankiewicz
  2020-06-09  9:15       ` [PATCH v3 02/15] PCI: Add macro for message signalled interrupt types Piotr Stankiewicz
  2020-06-09  9:18       ` [PATCH v3 07/15] drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate Piotr Stankiewicz
  2 siblings, 2 replies; 14+ messages in thread
From: Piotr Stankiewicz @ 2020-06-09  9:11 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci
  Cc: Ulf Hansson, Igor Russkikh, linux-doc, David Airlie, dri-devel,
	Jim Gill, netdev, Kurt Schwemmer, Herbert Xu, linux-scsi,
	Jonathan Corbet, linux-rdma, amd-gfx, Jason Gunthorpe,
	Doug Ledford, Jakub Kicinski, Yisen Zhuang, linux-media,
	Tom Lendacky, Arnd Bergmann, Antoine Tenart, linux-kernel,
	James E . J . Bottomley, Salil Mehta, dmaengine, Brian King,
	Piotr Stankiewicz, Dan Williams, Mauro Carvalho Chehab,
	Jens Axboe, Mike Marciniszyn, Martin K . Petersen,
	Gustavo Pimentel, Dennis Dalessandro, linux-mmc, Adrian Hunter,
	David S . Miller, Vinod Koul, linux-crypto, Greg Kroah-Hartman,
	Alex Deucher, Logan Gunthorpe, Christian König

The primary objective of this patch series is to change the behaviour
of pci_alloc_irq_vectors_affinity() such that it forwards the MSI-X enable
error code when appropriate. In the process, though, it was pointed out
that there are multiple places in the kernel which check/ask for message
signalled interrupts (MSI or MSI-X), which spawned the first patch adding
PCI_IRQ_MSI_TYPES. Finally the rest of the chain converts all users to
take advantage of PCI_IRQ_MSI_TYPES or PCI_IRQ_ALL_TYPES, as
appropriate.

Piotr Stankiewicz (15):
  PCI/MSI: Forward MSI-X vector enable error code in
    pci_alloc_irq_vectors_affinity()
  PCI: Add macro for message signalled interrupt types
  PCI: Use PCI_IRQ_MSI_TYPES where appropriate
  ahci: Use PCI_IRQ_MSI_TYPES where appropriate
  crypto: inside-secure - Use PCI_IRQ_MSI_TYPES where appropriate
  dmaengine: dw-edma: Use PCI_IRQ_MSI_TYPES  where appropriate
  drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate
  IB/qib: Use PCI_IRQ_MSI_TYPES where appropriate
  media: ddbridge: Use PCI_IRQ_MSI_TYPES where appropriate
  vmw_vmci: Use PCI_IRQ_ALL_TYPES where appropriate
  mmc: sdhci: Use PCI_IRQ_MSI_TYPES where appropriate
  amd-xgbe: Use PCI_IRQ_MSI_TYPES where appropriate
  aquantia: atlantic: Use PCI_IRQ_ALL_TYPES where appropriate
  net: hns3: Use PCI_IRQ_MSI_TYPES where appropriate
  scsi: Use PCI_IRQ_MSI_TYPES and PCI_IRQ_ALL_TYPES where appropriate

 Documentation/PCI/msi-howto.rst               |  5 +++--
 drivers/ata/ahci.c                            |  2 +-
 drivers/crypto/inside-secure/safexcel.c       |  2 +-
 drivers/dma/dw-edma/dw-edma-pcie.c            |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c       | 11 +---------
 drivers/infiniband/hw/qib/qib_pcie.c          |  6 +++--
 drivers/media/pci/ddbridge/ddbridge-main.c    |  2 +-
 drivers/misc/vmw_vmci/vmci_guest.c            |  3 +--
 drivers/mmc/host/sdhci-pci-gli.c              |  3 +--
 drivers/mmc/host/sdhci-pci-o2micro.c          |  3 +--
 drivers/net/ethernet/amd/xgbe/xgbe-pci.c      |  2 +-
 .../ethernet/aquantia/atlantic/aq_pci_func.c  |  4 +---
 .../hisilicon/hns3/hns3pf/hclge_main.c        |  3 +--
 .../hisilicon/hns3/hns3vf/hclgevf_main.c      |  3 +--
 drivers/pci/msi.c                             | 22 ++++++++-----------
 drivers/pci/pcie/portdrv_core.c               |  4 ++--
 drivers/pci/switch/switchtec.c                |  3 +--
 drivers/scsi/ipr.c                            |  5 +++--
 drivers/scsi/vmw_pvscsi.c                     |  2 +-
 include/linux/pci.h                           |  4 ++--
 20 files changed, 37 insertions(+), 54 deletions(-)

-- 
2.17.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v3 02/15] PCI: Add macro for message signalled interrupt types
  2020-06-09  9:11     ` [PATCH v3 00/15] Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity() Piotr Stankiewicz
@ 2020-06-09  9:15       ` Piotr Stankiewicz
  2020-06-09  9:18       ` [PATCH v3 07/15] drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate Piotr Stankiewicz
  1 sibling, 0 replies; 14+ messages in thread
From: Piotr Stankiewicz @ 2020-06-09  9:15 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci
  Cc: Krzysztof Wilczynski, Ulf Hansson, Igor Russkikh, linux-doc,
	David Airlie, Kuppuswamy Sathyanarayanan, dri-devel, Jim Gill,
	netdev, Yicong Yang, Kurt Schwemmer, Herbert Xu, linux-scsi,
	Jonathan Corbet, linux-rdma, Rafael J. Wysocki, amd-gfx,
	Jason Gunthorpe, Doug Ledford, Zenghui Yu, Jakub Kicinski,
	Yisen Zhuang, linux-media, Tom Lendacky, Arnd Bergmann,
	Antoine Tenart, linux-kernel, James E . J . Bottomley,
	Salil Mehta, Denis Efremov, dmaengine, Brian King,
	Piotr Stankiewicz, Dan Williams, Mauro Carvalho Chehab,
	Andy Shevchenko, Jens Axboe, Mike Marciniszyn,
	Martin K . Petersen, Gustavo Pimentel, Dennis Dalessandro,
	linux-mmc, Adrian Hunter, David S . Miller, Vinod Koul,
	linux-crypto, Greg Kroah-Hartman, Alex Deucher, Kelsey Skunberg,
	Logan Gunthorpe, Christian König, Heiner Kallweit

There are several places in the kernel which check/ask for MSI or MSI-X
interrupts. It would make sense to have a macro which defines all types
of message signalled interrupts, to use in such situations. Add
PCI_IRQ_MSI_TYPES, for this purpose.

Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@intel.com>
Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
---
 Documentation/PCI/msi-howto.rst | 5 +++--
 include/linux/pci.h             | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Documentation/PCI/msi-howto.rst b/Documentation/PCI/msi-howto.rst
index aa2046af69f7..2800ff5aa395 100644
--- a/Documentation/PCI/msi-howto.rst
+++ b/Documentation/PCI/msi-howto.rst
@@ -105,7 +105,8 @@ if it can't meet the minimum number of vectors.
 The flags argument is used to specify which type of interrupt can be used
 by the device and the driver (PCI_IRQ_LEGACY, PCI_IRQ_MSI, PCI_IRQ_MSIX).
 A convenient short-hand (PCI_IRQ_ALL_TYPES) is also available to ask for
-any possible kind of interrupt.  If the PCI_IRQ_AFFINITY flag is set,
+any possible kind of interrupt, and (PCI_IRQ_MSI_TYPES) to ask for message
+signalled interrupts (MSI or MSI-X).  If the PCI_IRQ_AFFINITY flag is set,
 pci_alloc_irq_vectors() will spread the interrupts around the available CPUs.
 
 To get the Linux IRQ numbers passed to request_irq() and free_irq() and the
@@ -160,7 +161,7 @@ the single MSI mode for a device.  It could be done by passing two 1s as
 Some devices might not support using legacy line interrupts, in which case
 the driver can specify that only MSI or MSI-X is acceptable::
 
-	nvec = pci_alloc_irq_vectors(pdev, 1, nvec, PCI_IRQ_MSI | PCI_IRQ_MSIX);
+	nvec = pci_alloc_irq_vectors(pdev, 1, nvec, PCI_IRQ_MSI_TYPES);
 	if (nvec < 0)
 		goto out_err;
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c79d83304e52..a99094f17b21 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1431,8 +1431,8 @@ int pci_set_vga_state(struct pci_dev *pdev, bool decode,
  */
 #define PCI_IRQ_VIRTUAL		(1 << 4)
 
-#define PCI_IRQ_ALL_TYPES \
-	(PCI_IRQ_LEGACY | PCI_IRQ_MSI | PCI_IRQ_MSIX)
+#define PCI_IRQ_MSI_TYPES	(PCI_IRQ_MSI | PCI_IRQ_MSIX)
+#define PCI_IRQ_ALL_TYPES	(PCI_IRQ_LEGACY | PCI_IRQ_MSI_TYPES)
 
 /* kmem_cache style wrapper around pci_alloc_consistent() */
 
-- 
2.17.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 07/15] drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate
  2020-06-09  9:11     ` [PATCH v3 00/15] Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity() Piotr Stankiewicz
  2020-06-09  9:15       ` [PATCH v3 02/15] PCI: Add macro for message signalled interrupt types Piotr Stankiewicz
@ 2020-06-09  9:18       ` Piotr Stankiewicz
  2020-06-09 20:23         ` Alex Deucher
  1 sibling, 1 reply; 14+ messages in thread
From: Piotr Stankiewicz @ 2020-06-09  9:18 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci
  Cc: David Airlie, Aurabindo Pillai, linux-kernel, amd-gfx,
	Piotr Stankiewicz, dri-devel, Alex Deucher, shaoyunl,
	Sam Ravnborg, Christian König, Hawking Zhang

Seeing as there is shorthand available to use when asking for any type
of interrupt, or any type of message signalled interrupt, leverage it.

Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 0cc4c67f95f7..97141aa81f32 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -248,17 +248,8 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
 	adev->irq.msi_enabled = false;
 
 	if (amdgpu_msi_ok(adev)) {
-		int nvec = pci_msix_vec_count(adev->pdev);
-		unsigned int flags;
-
-		if (nvec <= 0) {
-			flags = PCI_IRQ_MSI;
-		} else {
-			flags = PCI_IRQ_MSI | PCI_IRQ_MSIX;
-		}
 		/* we only need one vector */
-		nvec = pci_alloc_irq_vectors(adev->pdev, 1, 1, flags);
-		if (nvec > 0) {
+		if (pci_alloc_irq_vectors(adev->pdev, 1, 1, PCI_IRQ_MSI_TYPES) > 0) {
 			adev->irq.msi_enabled = true;
 			dev_dbg(adev->dev, "using MSI/MSI-X.\n");
 		}
-- 
2.17.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 07/15] drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate
  2020-06-09  9:18       ` [PATCH v3 07/15] drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate Piotr Stankiewicz
@ 2020-06-09 20:23         ` Alex Deucher
  2020-06-16  7:49           ` Stankiewicz, Piotr
  2020-06-16  8:42           ` [PATCH] drm/amdgpu: Simplify IRQ vector request logic Piotr Stankiewicz
  0 siblings, 2 replies; 14+ messages in thread
From: Alex Deucher @ 2020-06-09 20:23 UTC (permalink / raw)
  To: Piotr Stankiewicz
  Cc: David Airlie, Linux PCI, Aurabindo Pillai, LKML, amd-gfx list,
	Alex Deucher, Maling list - DRI developers, Bjorn Helgaas,
	Hawking Zhang, Sam Ravnborg, Christian König, shaoyunl

On Tue, Jun 9, 2020 at 5:18 AM Piotr Stankiewicz
<piotr.stankiewicz@intel.com> wrote:
>
> Seeing as there is shorthand available to use when asking for any type
> of interrupt, or any type of message signalled interrupt, leverage it.
>
> Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@intel.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> index 0cc4c67f95f7..97141aa81f32 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> @@ -248,17 +248,8 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>         adev->irq.msi_enabled = false;
>
>         if (amdgpu_msi_ok(adev)) {
> -               int nvec = pci_msix_vec_count(adev->pdev);
> -               unsigned int flags;
> -
> -               if (nvec <= 0) {
> -                       flags = PCI_IRQ_MSI;
> -               } else {
> -                       flags = PCI_IRQ_MSI | PCI_IRQ_MSIX;
> -               }
>                 /* we only need one vector */
> -               nvec = pci_alloc_irq_vectors(adev->pdev, 1, 1, flags);
> -               if (nvec > 0) {
> +               if (pci_alloc_irq_vectors(adev->pdev, 1, 1, PCI_IRQ_MSI_TYPES) > 0) {
>                         adev->irq.msi_enabled = true;
>                         dev_dbg(adev->dev, "using MSI/MSI-X.\n");
>                 }
> --
> 2.17.2
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [PATCH v3 07/15] drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate
  2020-06-09 20:23         ` Alex Deucher
@ 2020-06-16  7:49           ` Stankiewicz, Piotr
  2020-06-16  8:42           ` [PATCH] drm/amdgpu: Simplify IRQ vector request logic Piotr Stankiewicz
  1 sibling, 0 replies; 14+ messages in thread
From: Stankiewicz, Piotr @ 2020-06-16  7:49 UTC (permalink / raw)
  To: Alex Deucher
  Cc: David Airlie, Linux PCI, Aurabindo Pillai, LKML, amd-gfx list,
	Alex Deucher, Maling list - DRI developers, Bjorn Helgaas,
	Hawking Zhang, Sam Ravnborg, Christian König, shaoyunl

> -----Original Message-----
> From: Alex Deucher <alexdeucher@gmail.com>
> Sent: Tuesday, June 9, 2020 10:24 PM
> 
> On Tue, Jun 9, 2020 at 5:18 AM Piotr Stankiewicz
> <piotr.stankiewicz@intel.com> wrote:
> >
> > Seeing as there is shorthand available to use when asking for any type
> > of interrupt, or any type of message signalled interrupt, leverage it.
> >
> > Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@intel.com>
> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> 
> Acked-by: Alex Deucher <alexander.deucher@amd.com>
> 

Thanks. Adding PCI_IRQ_MSI_TYPES won't land upstream. But I'll send
a patch with the other simplifications, just now.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] drm/amdgpu: Simplify IRQ vector request logic
  2020-06-09 20:23         ` Alex Deucher
  2020-06-16  7:49           ` Stankiewicz, Piotr
@ 2020-06-16  8:42           ` Piotr Stankiewicz
  1 sibling, 0 replies; 14+ messages in thread
From: Piotr Stankiewicz @ 2020-06-16  8:42 UTC (permalink / raw)
  To: Alex Deucher
  Cc: David Airlie, Aurabindo Pillai, linux-kernel, amd-gfx,
	Emily Deng, Piotr Stankiewicz, dri-devel, shaoyunl,
	Christian König, Hawking Zhang

pci_alloc_irq_vectors() will handle fallback from MSI-X to MSI
internally, if necessary. So remove checks which determine if we are
dealing with MSI or MSI-X and rely on pci_alloc_irq_vectors() to do the
right thing.

Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 0cc4c67f95f7..2d68ad7d45d4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -248,17 +248,8 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
 	adev->irq.msi_enabled = false;
 
 	if (amdgpu_msi_ok(adev)) {
-		int nvec = pci_msix_vec_count(adev->pdev);
-		unsigned int flags;
-
-		if (nvec <= 0) {
-			flags = PCI_IRQ_MSI;
-		} else {
-			flags = PCI_IRQ_MSI | PCI_IRQ_MSIX;
-		}
 		/* we only need one vector */
-		nvec = pci_alloc_irq_vectors(adev->pdev, 1, 1, flags);
-		if (nvec > 0) {
+		if (pci_alloc_irq_vectors(adev->pdev, 1, 1, PCI_IRQ_MSI | PCI_IRQ_MSIX) > 0) {
 			adev->irq.msi_enabled = true;
 			dev_dbg(adev->dev, "using MSI/MSI-X.\n");
 		}
-- 
2.17.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-06-16  8:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02  9:16 [PATCH 00/15] forward MSIx vector enable error code in pci_alloc_irq_vectors_affinity Piotr Stankiewicz
2020-06-02 23:06 ` Bjorn Helgaas
2020-06-03 11:42   ` [PATCH v2 00/15] Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity() Piotr Stankiewicz
2020-06-03 11:45     ` [PATCH v2 02/15] PCI: Add shorthand define for message signalled interrupt types Piotr Stankiewicz
2020-06-03 15:49       ` Logan Gunthorpe
2020-06-04  1:55       ` Luben Tuikov
2020-06-03 11:47     ` [PATCH v2 07/15] drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate Piotr Stankiewicz
2020-06-03 13:43       ` Alex Deucher
2020-06-09  9:11     ` [PATCH v3 00/15] Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity() Piotr Stankiewicz
2020-06-09  9:15       ` [PATCH v3 02/15] PCI: Add macro for message signalled interrupt types Piotr Stankiewicz
2020-06-09  9:18       ` [PATCH v3 07/15] drm/amdgpu: Use PCI_IRQ_MSI_TYPES where appropriate Piotr Stankiewicz
2020-06-09 20:23         ` Alex Deucher
2020-06-16  7:49           ` Stankiewicz, Piotr
2020-06-16  8:42           ` [PATCH] drm/amdgpu: Simplify IRQ vector request logic Piotr Stankiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).