Linux-HyperV Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] PCI: export and use pci_msi_get_hwirq in pci-hyperv.c
@ 2020-04-22 19:58 Wei Liu
  2020-05-07 20:58 ` Rob Herring
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Liu @ 2020-04-22 19:58 UTC (permalink / raw)
  To: linux-pci
  Cc: linux-hyperv, linux-kernel, Wei Liu, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, x86,
	K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger,
	Lorenzo Pieralisi, Andrew Murray, Bjorn Helgaas, Allison Randal,
	Greg Kroah-Hartman, Enrico Weigelt

There is a functionally identical function in pci-hyperv.c. Drop it and
use pci_msi_get_hwirq instead.

This requires exporting pci_msi_get_hwirq and declaring it in msi.h.

No functional change intended.

Signed-off-by: Wei Liu <wei.liu@kernel.org>
---
 arch/x86/include/asm/msi.h          | 4 ++++
 arch/x86/kernel/apic/msi.c          | 5 +++--
 drivers/pci/controller/pci-hyperv.c | 8 +-------
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/msi.h b/arch/x86/include/asm/msi.h
index 25ddd0916bb2..353b80122b2e 100644
--- a/arch/x86/include/asm/msi.h
+++ b/arch/x86/include/asm/msi.h
@@ -11,4 +11,8 @@ int pci_msi_prepare(struct irq_domain *domain, struct device *dev, int nvec,
 
 void pci_msi_set_desc(msi_alloc_info_t *arg, struct msi_desc *desc);
 
+struct msi_domain_info;
+irq_hw_number_t pci_msi_get_hwirq(struct msi_domain_info *info,
+				  msi_alloc_info_t *arg);
+
 #endif /* _ASM_X86_MSI_H */
diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c
index 159bd0cb8548..56dcdd912564 100644
--- a/arch/x86/kernel/apic/msi.c
+++ b/arch/x86/kernel/apic/msi.c
@@ -204,11 +204,12 @@ void native_teardown_msi_irq(unsigned int irq)
 	irq_domain_free_irqs(irq, 1);
 }
 
-static irq_hw_number_t pci_msi_get_hwirq(struct msi_domain_info *info,
-					 msi_alloc_info_t *arg)
+irq_hw_number_t pci_msi_get_hwirq(struct msi_domain_info *info,
+				  msi_alloc_info_t *arg)
 {
 	return arg->msi_hwirq;
 }
+EXPORT_SYMBOL_GPL(pci_msi_get_hwirq);
 
 int pci_msi_prepare(struct irq_domain *domain, struct device *dev, int nvec,
 		    msi_alloc_info_t *arg)
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index e6020480a28b..2b4a6452095f 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -1520,14 +1520,8 @@ static struct irq_chip hv_msi_irq_chip = {
 	.irq_unmask		= hv_irq_unmask,
 };
 
-static irq_hw_number_t hv_msi_domain_ops_get_hwirq(struct msi_domain_info *info,
-						   msi_alloc_info_t *arg)
-{
-	return arg->msi_hwirq;
-}
-
 static struct msi_domain_ops hv_msi_ops = {
-	.get_hwirq	= hv_msi_domain_ops_get_hwirq,
+	.get_hwirq	= pci_msi_get_hwirq,
 	.msi_prepare	= pci_msi_prepare,
 	.set_desc	= pci_msi_set_desc,
 	.msi_free	= hv_msi_free,
-- 
2.20.1


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

* Re: [PATCH] PCI: export and use pci_msi_get_hwirq in pci-hyperv.c
  2020-04-22 19:58 [PATCH] PCI: export and use pci_msi_get_hwirq in pci-hyperv.c Wei Liu
@ 2020-05-07 20:58 ` Rob Herring
  2020-05-11 15:32   ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2020-05-07 20:58 UTC (permalink / raw)
  To: Wei Liu
  Cc: linux-pci, linux-hyperv, linux-kernel, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, x86,
	K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger,
	Lorenzo Pieralisi, Andrew Murray, Bjorn Helgaas, Allison Randal,
	Greg Kroah-Hartman, Enrico Weigelt

On Wed, Apr 22, 2020 at 07:58:15PM +0000, Wei Liu wrote:
> There is a functionally identical function in pci-hyperv.c. Drop it and
> use pci_msi_get_hwirq instead.
> 
> This requires exporting pci_msi_get_hwirq and declaring it in msi.h.
> 
> No functional change intended.
> 
> Signed-off-by: Wei Liu <wei.liu@kernel.org>
> ---
>  arch/x86/include/asm/msi.h          | 4 ++++
>  arch/x86/kernel/apic/msi.c          | 5 +++--
>  drivers/pci/controller/pci-hyperv.c | 8 +-------
>  3 files changed, 8 insertions(+), 9 deletions(-)

Would be better if done in a way to remove an x86 dependency. 

I guess this would do it:

#define pci_msi_get_hwirq NULL

when GENERIC_MSI_DOMAIN_OPS is enabled.

> 
> diff --git a/arch/x86/include/asm/msi.h b/arch/x86/include/asm/msi.h
> index 25ddd0916bb2..353b80122b2e 100644
> --- a/arch/x86/include/asm/msi.h
> +++ b/arch/x86/include/asm/msi.h
> @@ -11,4 +11,8 @@ int pci_msi_prepare(struct irq_domain *domain, struct device *dev, int nvec,
>  
>  void pci_msi_set_desc(msi_alloc_info_t *arg, struct msi_desc *desc);
>  
> +struct msi_domain_info;
> +irq_hw_number_t pci_msi_get_hwirq(struct msi_domain_info *info,
> +				  msi_alloc_info_t *arg);
> +
>  #endif /* _ASM_X86_MSI_H */
> diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c
> index 159bd0cb8548..56dcdd912564 100644
> --- a/arch/x86/kernel/apic/msi.c
> +++ b/arch/x86/kernel/apic/msi.c
> @@ -204,11 +204,12 @@ void native_teardown_msi_irq(unsigned int irq)
>  	irq_domain_free_irqs(irq, 1);
>  }
>  
> -static irq_hw_number_t pci_msi_get_hwirq(struct msi_domain_info *info,
> -					 msi_alloc_info_t *arg)
> +irq_hw_number_t pci_msi_get_hwirq(struct msi_domain_info *info,
> +				  msi_alloc_info_t *arg)
>  {
>  	return arg->msi_hwirq;
>  }
> +EXPORT_SYMBOL_GPL(pci_msi_get_hwirq);
>  
>  int pci_msi_prepare(struct irq_domain *domain, struct device *dev, int nvec,
>  		    msi_alloc_info_t *arg)
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index e6020480a28b..2b4a6452095f 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -1520,14 +1520,8 @@ static struct irq_chip hv_msi_irq_chip = {
>  	.irq_unmask		= hv_irq_unmask,
>  };
>  
> -static irq_hw_number_t hv_msi_domain_ops_get_hwirq(struct msi_domain_info *info,
> -						   msi_alloc_info_t *arg)
> -{
> -	return arg->msi_hwirq;
> -}
> -
>  static struct msi_domain_ops hv_msi_ops = {
> -	.get_hwirq	= hv_msi_domain_ops_get_hwirq,
> +	.get_hwirq	= pci_msi_get_hwirq,
>  	.msi_prepare	= pci_msi_prepare,
>  	.set_desc	= pci_msi_set_desc,
>  	.msi_free	= hv_msi_free,
> -- 
> 2.20.1
> 

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

* Re: [PATCH] PCI: export and use pci_msi_get_hwirq in pci-hyperv.c
  2020-05-07 20:58 ` Rob Herring
@ 2020-05-11 15:32   ` Wei Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Liu @ 2020-05-11 15:32 UTC (permalink / raw)
  To: Rob Herring
  Cc: Wei Liu, linux-pci, linux-hyperv, linux-kernel, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, x86,
	K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger,
	Lorenzo Pieralisi, Andrew Murray, Bjorn Helgaas, Allison Randal,
	Greg Kroah-Hartman, Enrico Weigelt

On Thu, May 07, 2020 at 03:58:31PM -0500, Rob Herring wrote:
> On Wed, Apr 22, 2020 at 07:58:15PM +0000, Wei Liu wrote:
> > There is a functionally identical function in pci-hyperv.c. Drop it and
> > use pci_msi_get_hwirq instead.
> > 
> > This requires exporting pci_msi_get_hwirq and declaring it in msi.h.
> > 
> > No functional change intended.
> > 
> > Signed-off-by: Wei Liu <wei.liu@kernel.org>
> > ---
> >  arch/x86/include/asm/msi.h          | 4 ++++
> >  arch/x86/kernel/apic/msi.c          | 5 +++--
> >  drivers/pci/controller/pci-hyperv.c | 8 +-------
> >  3 files changed, 8 insertions(+), 9 deletions(-)
> 
> Would be better if done in a way to remove an x86 dependency. 

This is a good point, Rob. I will see what I can do.

Wei.

> 
> I guess this would do it:
> 
> #define pci_msi_get_hwirq NULL
> 
> when GENERIC_MSI_DOMAIN_OPS is enabled.

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22 19:58 [PATCH] PCI: export and use pci_msi_get_hwirq in pci-hyperv.c Wei Liu
2020-05-07 20:58 ` Rob Herring
2020-05-11 15:32   ` Wei Liu

Linux-HyperV Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hyperv/0 linux-hyperv/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-hyperv linux-hyperv/ https://lore.kernel.org/linux-hyperv \
		linux-hyperv@vger.kernel.org
	public-inbox-index linux-hyperv

Example config snippet for mirrors

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


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