Linux-PCI Archive on lore.kernel.org
 help / color / Atom feed
* PCI: Add stub pci_irq_vector and others
       [not found]     ` <CAKv+Gu8PVYyA-mzjrhR6r6upMc=xzpAhsbkuKRtb8T2noo_2XQ@mail.gmail.com>
@ 2019-09-04 12:26       ` Herbert Xu
  2019-09-04 14:33         ` Yuehaibing
  2019-09-05 21:07         ` Bjorn Helgaas
  0 siblings, 2 replies; 4+ messages in thread
From: Herbert Xu @ 2019-09-04 12:26 UTC (permalink / raw)
  To: Ard Biesheuvel, Bjorn Helgaas, linux-pci
  Cc: Pascal Van Leeuwen, YueHaibing, antoine.tenart, davem,
	pvanleeuwen, linux-crypto, linux-kernel

On Wed, Sep 04, 2019 at 05:10:34AM -0700, Ard Biesheuvel wrote:
>
> This is the reason we have so many empty static inline functions in
> header files - it ensures that the symbols are declared even if the
> only invocations are from dead code.

Does this patch work?

---8<---
This patch adds stub functions pci_alloc_irq_vectors_affinity and
pci_irq_vector when CONFIG_PCI is off so that drivers can use them
without resorting to ifdefs.

It also moves the PCI_IRQ_* macros outside of the ifdefs so that
they are always available.

Fixes: 625f269a5a7a ("crypto: inside-secure - add support for...")
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9e700d9f9f28..74415ee62211 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -925,6 +925,11 @@ enum {
 	PCI_SCAN_ALL_PCIE_DEVS	= 0x00000040,	/* Scan all, not just dev 0 */
 };
 
+#define PCI_IRQ_LEGACY		(1 << 0) /* Allow legacy interrupts */
+#define PCI_IRQ_MSI		(1 << 1) /* Allow MSI interrupts */
+#define PCI_IRQ_MSIX		(1 << 2) /* Allow MSI-X interrupts */
+#define PCI_IRQ_AFFINITY	(1 << 3) /* Auto-assign affinity */
+
 /* These external functions are only available when PCI support is enabled */
 #ifdef CONFIG_PCI
 
@@ -1408,11 +1413,6 @@ resource_size_t pcibios_window_alignment(struct pci_bus *bus,
 int pci_set_vga_state(struct pci_dev *pdev, bool decode,
 		      unsigned int command_bits, u32 flags);
 
-#define PCI_IRQ_LEGACY		(1 << 0) /* Allow legacy interrupts */
-#define PCI_IRQ_MSI		(1 << 1) /* Allow MSI interrupts */
-#define PCI_IRQ_MSIX		(1 << 2) /* Allow MSI-X interrupts */
-#define PCI_IRQ_AFFINITY	(1 << 3) /* Auto-assign affinity */
-
 /*
  * Virtual interrupts allow for more interrupts to be allocated
  * than the device has interrupts for. These are not programmed
@@ -1517,14 +1517,6 @@ static inline int pci_irq_get_node(struct pci_dev *pdev, int vec)
 }
 #endif
 
-static inline int
-pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
-		      unsigned int max_vecs, unsigned int flags)
-{
-	return pci_alloc_irq_vectors_affinity(dev, min_vecs, max_vecs, flags,
-					      NULL);
-}
-
 /**
  * pci_irqd_intx_xlate() - Translate PCI INTx value to an IRQ domain hwirq
  * @d: the INTx IRQ domain
@@ -1780,8 +1772,29 @@ static inline const struct pci_device_id *pci_match_id(const struct pci_device_i
 							 struct pci_dev *dev)
 { return NULL; }
 static inline bool pci_ats_disabled(void) { return true; }
+
+static inline int pci_irq_vector(struct pci_dev *dev, unsigned int nr)
+{
+	return -EINVAL;
+}
+
+static inline int
+pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
+			       unsigned int max_vecs, unsigned int flags,
+			       struct irq_affinity *aff_desc)
+{
+	return -ENOSPC;
+}
 #endif /* CONFIG_PCI */
 
+static inline int
+pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
+		      unsigned int max_vecs, unsigned int flags)
+{
+	return pci_alloc_irq_vectors_affinity(dev, min_vecs, max_vecs, flags,
+					      NULL);
+}
+
 #ifdef CONFIG_PCI_ATS
 /* Address Translation Service */
 void pci_ats_init(struct pci_dev *dev);
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: PCI: Add stub pci_irq_vector and others
  2019-09-04 12:26       ` PCI: Add stub pci_irq_vector and others Herbert Xu
@ 2019-09-04 14:33         ` Yuehaibing
  2019-09-05 21:07         ` Bjorn Helgaas
  1 sibling, 0 replies; 4+ messages in thread
From: Yuehaibing @ 2019-09-04 14:33 UTC (permalink / raw)
  To: Herbert Xu, Ard Biesheuvel, Bjorn Helgaas, linux-pci
  Cc: Pascal Van Leeuwen, antoine.tenart, davem, pvanleeuwen,
	linux-crypto, linux-kernel

On 2019/9/4 20:26, Herbert Xu wrote:
> On Wed, Sep 04, 2019 at 05:10:34AM -0700, Ard Biesheuvel wrote:
>>
>> This is the reason we have so many empty static inline functions in
>> header files - it ensures that the symbols are declared even if the
>> only invocations are from dead code.
> 
> Does this patch work?

It works, Thanks.

Tested-by: YueHaibing <yuehaibing@huawei.com>

> 
> ---8<---
> This patch adds stub functions pci_alloc_irq_vectors_affinity and
> pci_irq_vector when CONFIG_PCI is off so that drivers can use them
> without resorting to ifdefs.
> 
> It also moves the PCI_IRQ_* macros outside of the ifdefs so that
> they are always available.
> 
> Fixes: 625f269a5a7a ("crypto: inside-secure - add support for...")
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: YueHaibing <yuehaibing@huawei.com>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 9e700d9f9f28..74415ee62211 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -925,6 +925,11 @@ enum {
>  	PCI_SCAN_ALL_PCIE_DEVS	= 0x00000040,	/* Scan all, not just dev 0 */
>  };
>  
> +#define PCI_IRQ_LEGACY		(1 << 0) /* Allow legacy interrupts */
> +#define PCI_IRQ_MSI		(1 << 1) /* Allow MSI interrupts */
> +#define PCI_IRQ_MSIX		(1 << 2) /* Allow MSI-X interrupts */
> +#define PCI_IRQ_AFFINITY	(1 << 3) /* Auto-assign affinity */
> +
>  /* These external functions are only available when PCI support is enabled */
>  #ifdef CONFIG_PCI
>  
> @@ -1408,11 +1413,6 @@ resource_size_t pcibios_window_alignment(struct pci_bus *bus,
>  int pci_set_vga_state(struct pci_dev *pdev, bool decode,
>  		      unsigned int command_bits, u32 flags);
>  
> -#define PCI_IRQ_LEGACY		(1 << 0) /* Allow legacy interrupts */
> -#define PCI_IRQ_MSI		(1 << 1) /* Allow MSI interrupts */
> -#define PCI_IRQ_MSIX		(1 << 2) /* Allow MSI-X interrupts */
> -#define PCI_IRQ_AFFINITY	(1 << 3) /* Auto-assign affinity */
> -
>  /*
>   * Virtual interrupts allow for more interrupts to be allocated
>   * than the device has interrupts for. These are not programmed
> @@ -1517,14 +1517,6 @@ static inline int pci_irq_get_node(struct pci_dev *pdev, int vec)
>  }
>  #endif
>  
> -static inline int
> -pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
> -		      unsigned int max_vecs, unsigned int flags)
> -{
> -	return pci_alloc_irq_vectors_affinity(dev, min_vecs, max_vecs, flags,
> -					      NULL);
> -}
> -
>  /**
>   * pci_irqd_intx_xlate() - Translate PCI INTx value to an IRQ domain hwirq
>   * @d: the INTx IRQ domain
> @@ -1780,8 +1772,29 @@ static inline const struct pci_device_id *pci_match_id(const struct pci_device_i
>  							 struct pci_dev *dev)
>  { return NULL; }
>  static inline bool pci_ats_disabled(void) { return true; }
> +
> +static inline int pci_irq_vector(struct pci_dev *dev, unsigned int nr)
> +{
> +	return -EINVAL;
> +}
> +
> +static inline int
> +pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
> +			       unsigned int max_vecs, unsigned int flags,
> +			       struct irq_affinity *aff_desc)
> +{
> +	return -ENOSPC;
> +}
>  #endif /* CONFIG_PCI */
>  
> +static inline int
> +pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
> +		      unsigned int max_vecs, unsigned int flags)
> +{
> +	return pci_alloc_irq_vectors_affinity(dev, min_vecs, max_vecs, flags,
> +					      NULL);
> +}
> +
>  #ifdef CONFIG_PCI_ATS
>  /* Address Translation Service */
>  void pci_ats_init(struct pci_dev *dev);
> 


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

* Re: PCI: Add stub pci_irq_vector and others
  2019-09-04 12:26       ` PCI: Add stub pci_irq_vector and others Herbert Xu
  2019-09-04 14:33         ` Yuehaibing
@ 2019-09-05 21:07         ` Bjorn Helgaas
  2019-09-05 22:53           ` Herbert Xu
  1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2019-09-05 21:07 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Ard Biesheuvel, linux-pci, Pascal Van Leeuwen, YueHaibing,
	antoine.tenart, davem, pvanleeuwen, linux-crypto, linux-kernel

On Wed, Sep 04, 2019 at 10:26:00PM +1000, Herbert Xu wrote:
> On Wed, Sep 04, 2019 at 05:10:34AM -0700, Ard Biesheuvel wrote:
> >
> > This is the reason we have so many empty static inline functions in
> > header files - it ensures that the symbols are declared even if the
> > only invocations are from dead code.
> 
> Does this patch work?
> 
> ---8<---
> This patch adds stub functions pci_alloc_irq_vectors_affinity and
> pci_irq_vector when CONFIG_PCI is off so that drivers can use them
> without resorting to ifdefs.
> 
> It also moves the PCI_IRQ_* macros outside of the ifdefs so that
> they are always available.
> 
> Fixes: 625f269a5a7a ("crypto: inside-secure - add support for...")

I don't see this commit in Linus' tree yet.

I'd like to include the actual reason for this patch in the commit
log.  I assume it's fixing a build issue, but I'd like to be a little
more specific about it.

> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: YueHaibing <yuehaibing@huawei.com>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 9e700d9f9f28..74415ee62211 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -925,6 +925,11 @@ enum {
>  	PCI_SCAN_ALL_PCIE_DEVS	= 0x00000040,	/* Scan all, not just dev 0 */
>  };
>  
> +#define PCI_IRQ_LEGACY		(1 << 0) /* Allow legacy interrupts */
> +#define PCI_IRQ_MSI		(1 << 1) /* Allow MSI interrupts */
> +#define PCI_IRQ_MSIX		(1 << 2) /* Allow MSI-X interrupts */
> +#define PCI_IRQ_AFFINITY	(1 << 3) /* Auto-assign affinity */
> +
>  /* These external functions are only available when PCI support is enabled */
>  #ifdef CONFIG_PCI
>  
> @@ -1408,11 +1413,6 @@ resource_size_t pcibios_window_alignment(struct pci_bus *bus,
>  int pci_set_vga_state(struct pci_dev *pdev, bool decode,
>  		      unsigned int command_bits, u32 flags);
>  
> -#define PCI_IRQ_LEGACY		(1 << 0) /* Allow legacy interrupts */
> -#define PCI_IRQ_MSI		(1 << 1) /* Allow MSI interrupts */
> -#define PCI_IRQ_MSIX		(1 << 2) /* Allow MSI-X interrupts */
> -#define PCI_IRQ_AFFINITY	(1 << 3) /* Auto-assign affinity */
> -
>  /*
>   * Virtual interrupts allow for more interrupts to be allocated
>   * than the device has interrupts for. These are not programmed
> @@ -1517,14 +1517,6 @@ static inline int pci_irq_get_node(struct pci_dev *pdev, int vec)
>  }
>  #endif
>  
> -static inline int
> -pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
> -		      unsigned int max_vecs, unsigned int flags)
> -{
> -	return pci_alloc_irq_vectors_affinity(dev, min_vecs, max_vecs, flags,
> -					      NULL);
> -}
> -
>  /**
>   * pci_irqd_intx_xlate() - Translate PCI INTx value to an IRQ domain hwirq
>   * @d: the INTx IRQ domain
> @@ -1780,8 +1772,29 @@ static inline const struct pci_device_id *pci_match_id(const struct pci_device_i
>  							 struct pci_dev *dev)
>  { return NULL; }
>  static inline bool pci_ats_disabled(void) { return true; }
> +
> +static inline int pci_irq_vector(struct pci_dev *dev, unsigned int nr)
> +{
> +	return -EINVAL;
> +}
> +
> +static inline int
> +pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
> +			       unsigned int max_vecs, unsigned int flags,
> +			       struct irq_affinity *aff_desc)
> +{
> +	return -ENOSPC;
> +}
>  #endif /* CONFIG_PCI */
>  
> +static inline int
> +pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
> +		      unsigned int max_vecs, unsigned int flags)
> +{
> +	return pci_alloc_irq_vectors_affinity(dev, min_vecs, max_vecs, flags,
> +					      NULL);
> +}
> +
>  #ifdef CONFIG_PCI_ATS
>  /* Address Translation Service */
>  void pci_ats_init(struct pci_dev *dev);
> -- 
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: PCI: Add stub pci_irq_vector and others
  2019-09-05 21:07         ` Bjorn Helgaas
@ 2019-09-05 22:53           ` Herbert Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2019-09-05 22:53 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Ard Biesheuvel, linux-pci, Pascal Van Leeuwen, YueHaibing,
	antoine.tenart, davem, pvanleeuwen, linux-crypto, linux-kernel

On Thu, Sep 05, 2019 at 04:07:22PM -0500, Bjorn Helgaas wrote:
>
> > This patch adds stub functions pci_alloc_irq_vectors_affinity and
> > pci_irq_vector when CONFIG_PCI is off so that drivers can use them
> > without resorting to ifdefs.
> > 
> > It also moves the PCI_IRQ_* macros outside of the ifdefs so that
> > they are always available.
> > 
> > Fixes: 625f269a5a7a ("crypto: inside-secure - add support for...")
> 
> I don't see this commit in Linus' tree yet.
> 
> I'd like to include the actual reason for this patch in the commit
> log.  I assume it's fixing a build issue, but I'd like to be a little
> more specific about it.

The patch in question is

https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git/commit/?id=625f269a5a7a3643771320387e474bd0a61d9654

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190902141910.1080-1-yuehaibing@huawei.com>
     [not found] ` <20190903014518.20880-1-yuehaibing@huawei.com>
     [not found]   ` <MN2PR20MB29732EEECB217DDDF822EDA5CAB80@MN2PR20MB2973.namprd20.prod.outlook.com>
     [not found]     ` <CAKv+Gu8PVYyA-mzjrhR6r6upMc=xzpAhsbkuKRtb8T2noo_2XQ@mail.gmail.com>
2019-09-04 12:26       ` PCI: Add stub pci_irq_vector and others Herbert Xu
2019-09-04 14:33         ` Yuehaibing
2019-09-05 21:07         ` Bjorn Helgaas
2019-09-05 22:53           ` Herbert Xu

Linux-PCI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pci/0 linux-pci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pci linux-pci/ https://lore.kernel.org/linux-pci \
		linux-pci@vger.kernel.org linux-pci@archiver.kernel.org
	public-inbox-index linux-pci


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pci


AGPL code for this site: git clone https://public-inbox.org/ public-inbox